<!--
 * @Author: your name
 * @Date: 2021-10-05 21:03:42
 * @LastEditTime: 2021-10-06 11:04:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue3.0\vue3_vite\src\components\RoutesList.vue
-->
<template>

  <template v-for="item in routes">
    <a-sub-menu :key="item.id" v-if="item.hasOwnProperty('children')">
      <template #icon>
        <AppstoreOutlined />
      </template>
      
      <template #title>{{item.name}}</template>
      <RouteList :routes="item.children" />
    </a-sub-menu>
    <a-menu-item :key="item.id" v-else>{{item.name}}</a-menu-item>
  </template>
</template>

<script>
import {
  AppstoreOutlined
} from '@ant-design/icons-vue';
const isShowRoute = (item) => {
  if (!item.hasOwnProperty('layout')) {
    return true
  }
  if (item.hasOwnProperty('layout') && item.layout === true) {
    return true
  } else {
    return false
  }
}
export default {
  name: 'RouteList',
  props: ['routes'],
  setup(props) {
    return {
      isShowRoute,
    }
  },
  components: {
    AppstoreOutlined
  }
}
</script>

<style>

</style>